home *** CD-ROM | disk | FTP | other *** search
/ Chip 2006 July / CHIP 2006-07.2.iso / program / web_gelistirme / easyphp1-7_setup.exe / {app} / phpmyadmin / ldi_table.php < prev    next >
Encoding:
PHP Script  |  2003-09-07  |  7.2 KB  |  197 lines

  1. <?php
  2. /* $Id: ldi_table.php,v 1.29 2003/07/28 17:47:07 lem9 Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5.  
  6. /**
  7.  * This file defines the forms used to insert a textfile into a table
  8.  */
  9.  
  10. require('./libraries/grab_globals.lib.php');
  11.  
  12. // Check parameters
  13. if (!defined('PMA_COMMON_LIB_INCLUDED')) {
  14.     include('./libraries/common.lib.php');
  15. }
  16. PMA_checkParameters(array('db', 'table'));
  17.  
  18.  
  19. /**
  20.  * Gets some core libraries and displays links
  21.  */
  22. require('./tbl_properties_common.php');
  23. $err_url   = 'ldi_table.php' . $err_url;
  24. $url_query .= '&goto=ldi_table.php&back=ldi_table.php';
  25. require('./tbl_properties_table_info.php');
  26.  
  27. /**
  28.  * Displays the form
  29.  */
  30. ?>
  31. <form action="ldi_check.php" method="post" enctype="multipart/form-data">
  32.     <table cellpadding="5" border="2">
  33.     <tr>
  34.         <td><?php echo $strLocationTextfile; ?></td>
  35.         <td colspan="2"><input type="file" name="textfile" />
  36.         <?php
  37. if ($cfg['UploadDir'] != '') {
  38.  
  39.     if ($handle = @opendir($cfg['UploadDir'])) {
  40.         $is_first = 0;
  41.         while ($file = @readdir($handle)) {
  42.             if (is_file($cfg['UploadDir'] . $file) && substr($file, -4) == '.csv') {
  43.                 if ($is_first == 0) {
  44.                     $is_upload_dir = true;
  45.                     echo "<br />\n";
  46.                     echo '    <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . ' : ' . "\n";
  47.                     echo '    <div style="margin-bottom: 5px">' . "\n";
  48.                     echo '        <select size="1" name="local_textfile">' . "\n";
  49.                     echo '            <option value="" selected="selected"></option>' . "\n";
  50.                 } // end if (is_first)
  51.                 echo '            <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
  52.                 $is_first++;
  53.             } // end if (is_file)
  54.         } // end while
  55.         if ($is_first > 0) {
  56.             echo '        </select>' . "\n"
  57.                     . '    </div>' . "\n\n";
  58.         } // end if (isfirst > 0)
  59.         @closedir($handle);
  60.     } else {
  61.         echo '    <div style="margin-bottom: 5px">' . "\n";
  62.         echo '        <font color="red">' . $strError . '</font><br />' . "\n";
  63.         echo '        ' . $strWebServerUploadDirectoryError . "\n";
  64.         echo '    </div>' . "\n";
  65.     }
  66. } // end if (web-server upload directory)
  67. echo "\n";
  68.         ?>
  69.         </td>
  70.     </tr>
  71.  
  72. <?php
  73. if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
  74.     $temp_charset = reset($cfg['AvailableCharsets']);
  75.     echo '    <tr>' . "\n"
  76.          . '        <td>' . $strCharsetOfFile . '</td>' . "\n"
  77.          . '        <td colspan="2">' . "\n"
  78.          . '            <select name="charset_of_file" size="1">' . "\n"
  79.          . '                <option value="' . $temp_charset . '"';
  80.     if ($temp_charset == $charset) {
  81.         echo ' selected="selected"';
  82.     }
  83.     echo '>' . $temp_charset . '</option>' . "\n";
  84.     while ($temp_charset = next($cfg['AvailableCharsets'])) {
  85.         echo '                <option value="' . $temp_charset . '"';
  86.         if ($temp_charset == $charset) {
  87.             echo ' selected="selected"';
  88.         }
  89.         echo '>' . $temp_charset . '</option>' . "\n";
  90.     } // end while
  91.     echo '            </select>' . "\n";
  92.     echo '        </td>' . "\n";
  93.     echo '    </tr>';
  94. } // end if
  95. echo "\n";
  96. ?>
  97.     <tr>
  98.         <td><?php echo $strReplaceTable; ?></td>
  99.         <td><input type="checkbox" name="replace" value="REPLACE" id="checkbox_replace" /><?php echo $strReplace; ?></td>
  100.         <td><label for="checkbox_replace"><?php echo $strTheContents; ?></label></td>
  101.     </tr>
  102.     <tr>
  103.         <td><?php echo $strFieldsTerminatedBy; ?></td>
  104.         <td><input type="text" name="field_terminater" size="2" maxlength="2" value=";" /></td>
  105.         <td><?php echo $strTheTerminator; ?></td>
  106.     </tr>
  107.     <tr>
  108.         <td><?php echo $strFieldsEnclosedBy; ?></td>
  109.         <td>
  110.             <input type="text" name="enclosed" size="1" maxlength="1" value=""" />
  111.             <input type="checkbox" name="enclose_option" value="OPTIONALLY" id="checkbox_enclose_option" />
  112.             <label for="checkbox_enclose_option"><?php echo $strOptionally; ?></label>
  113.         </td>
  114.         <td><?php echo $strOftenQuotation; ?></td>
  115.     </tr>
  116.     <tr>
  117.         <td><?php echo $strFieldsEscapedBy; ?></td>
  118.         <td><input type="text" name="escaped" size="2" maxlength="2" value="\" /></td>
  119.         <td><?php echo $strOptionalControls; ?></td>
  120.     </tr>
  121.     <tr>
  122.         <td><?php echo $strLinesTerminatedBy; ?></td>
  123.         <td><input type="text" name="line_terminator" size="8" maxlength="8" value="<?php echo ((PMA_whichCrlf() == "\n") ? '\n' : '\r\n'); ?>" /></td>
  124.         <td><?php echo $strCarriage; ?><br /><?php echo $strLineFeed; ?></td>
  125.     </tr>
  126.     <tr>
  127.         <td><?php echo $strColumnNames; ?></td>
  128.         <td><input type="text" name="column_name" /></td>
  129.         <td><?php echo $strIfYouWish; ?></td>
  130.     </tr>
  131. <?php
  132. // 2002/2/22 appended by Y.Kawada: Kanji encoding convert controls
  133. if (function_exists('PMA_set_enc_form')) {
  134.     echo '    <tr>' . "\n"
  135.          . '        <td>' . $strKanjiEncodConvert . '</td>' . "\n"
  136.          . '        <td colspan=2>' . "\n"
  137.          . PMA_set_enc_form('            ')
  138.          . '        </td>' . "\n"
  139.          . '    </tr>' . "\n";
  140. } // end if
  141.  
  142.  
  143. // Check if we should check the LOCAL radio button by default
  144. $local_option_selected = FALSE;
  145.  
  146. if (PMA_MYSQL_INT_VERSION < 32349) {
  147.         $local_option_selected = TRUE;
  148. }
  149.  
  150. if (PMA_MYSQL_INT_VERSION > 40003) {
  151.     $tmp_query  = "SHOW VARIABLES LIKE 'local\\_infile'";
  152.     $result = PMA_mysql_query($tmp_query);
  153.     if ($result != FALSE && mysql_num_rows($result) > 0) {
  154.         $tmp = PMA_mysql_fetch_row($result);
  155.         if ($tmp[1] == 'ON') {
  156.             $local_option_selected = TRUE;
  157.         }
  158.     }
  159.     mysql_free_result($result);
  160. }
  161.  
  162. ?>
  163.     <tr>
  164.         <td><?php echo $strLoadMethod; ?>
  165.         </td>
  166.         <td> 
  167.             <input type="radio" id="radio_local_option_0" name="local_option" value="0" <?php echo (!$local_option_selected ? ' checked="checked" ' : ''); ?>/><label for="radio_local_option_0">...DATA</label><br />
  168.             <input type="radio" id="radio_local_option_1" name="local_option" value="1" <?php echo ($local_option_selected ? ' checked="checked" ' : ''); ?>/><label for="radio_local_option_1">...DATA LOCAL</label>
  169.         </td>
  170.         <td><?php echo $strLoadExplanation; ?>
  171.         </td>
  172.     </tr>
  173.     <tr>
  174.         <td colspan="3" align="center"><?php print PMA_showMySQLDocu('Reference', 'LOAD_DATA'); ?></td>
  175.     </tr>
  176.     <tr>
  177.         <td colspan="3" align="center">
  178.             <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
  179.             <input type="hidden" name="zero_rows" value="<?php echo $strTheContent; ?>" />
  180.             <input type="hidden" name="goto" value="tbl_properties.php" />
  181.             <input type="hidden" name="back" value="ldi_table.php" />
  182.             <input type="hidden" name="into_table" value="<?php echo htmlspecialchars($table); ?>" />
  183.             <input type="submit" name="btnLDI" value="<?php echo $strSubmit; ?>" />  
  184.             <input type="reset" value="<?php echo $strReset; ?>" />
  185.         </td>
  186.     </tr>
  187. </table>
  188. </form>
  189.  
  190.  
  191. <?php
  192. /**
  193.  * Displays the footer
  194.  */
  195. require('./footer.inc.php');
  196. ?>
  197.